import 'package:flutter/material.dart';

class AppColor {
  /// 页面背景颜色
  static const Color scaffoldBackground = Color(0xFF1E1E1E);

  /// 主要背景颜色
  // static const Color primaryBackground = Color(0xFF5C78FF);

  /// 主要文本颜色
  static const Color primaryText = Color(0xFFFFFFFF);

  /// 次要文本颜色
  static const Color secondaryText = Color(0xFFAFAFAF);

  /// 高亮颜色
  static const Color accentColor = Color(0xFF5C78FF);

  /// 次要颜色
  static const Color secondaryColor = Color(0xFFDEE3FF);

  /// 警告颜色
  static const Color warnColor = Color(0xFFFFB822);

  /// 边框颜色
  static const Color borderColor = Color(0xFFDEE3FF);

  static const Color pinkColor = Color(0xFFF77866);

  static const Color yellowColor = Color(0xFFFFB822);

  // 创建MaterialColor
  static MaterialColor createMaterialColor(Color color) {
    List strengths = <double>[.05];
    Map<int, Color> swatch = {};
    final int r = color.red, g = color.green, b = color.blue;
    for (int i = 1; i < 10; i++) {
      strengths.add(0.1 * i);
    }
    for (var strength in strengths) {
      final double ds = 0.5 - strength;
      swatch[(strength * 1000).round()] = Color.fromRGBO(
        r + ((ds < 0 ? r : (255 - r)) * ds).round(),
        g + ((ds < 0 ? g : (255 - g)) * ds).round(),
        b + ((ds < 0 ? b : (255 - b)) * ds).round(),
        1,
      );
    }
    return MaterialColor(color.value, swatch);
  }
}
